import request from '@/utils/request'

// 查询列表
export function list (query) {
    return request({
        url: '/school/device/devicePage',
        method: 'get',
        params: query
    })
}

// 详情
export function getById (query) {
    return request({
        url: '/school/device/getById/' + query.id,
        method: 'get'
    })
}

// 新增·
export function add (data) {
    return request({
        url: '/school/device/add',
        method: 'post',
        data: data
    })
}

// 修改
export function edit (data) {
    return request({
        url: '/school/device/edit',
        method: 'put',
        data: data
    })
}

// 删除
export function deleteById (data) {
    return request({
        url: '/school/device/deleteById/' + data.id,
        method: 'delete',
        data
    })
}

// 根据设备编号或者设备名称获取设备列表
export function getListByDeviceNameOrDeviceNum (query) {
    return request({
        url: '/school/device/getListByDeviceNameOrDeviceNum',
        method: 'get',
        params: query
    })
}

// 根据设备id获取关联实验设备数据
export function getExperimentDeviceListByExperimentId (id) {
    return request({
        url: '/school/experimentDevices/getExperimentDeviceListByExperimentId/' + id,
        method: 'get'
    })
}

// 根据设备id获取关联实验设备数据
export function getExperimentDeviceListByDeviceId (query) {
    return request({
        url: '/school/experimentDevices/getExperimentDeviceListByDeviceId/' + query.deviceId,
        method: 'get',
        params: query
    })
}